/**
 * 
 */
package com.orange.handler.impl;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.orange.dbhelp.page.Page;
import com.orange.handler.AuthSchoolService;
import com.orange.modules.bean.SchoolItemBean;
import com.orange.modules.bean.expert.ExpertTaskBean;
import com.orange.modules.dao.school.AuthSchoolRepository;
import com.orange.modules.entity.school.AuthSchool;

/**
 * @author gaogs
 *
 *         2016-10-16
 */
@Service
public class AuthSchoolServiceImpl implements AuthSchoolService {

	@Autowired
	private AuthSchoolRepository authSchoolRepository;

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * com.orange.handler.AuthSchoolService#queryAuthSchoolInfoByAccount(java
	 * .lang.String)
	 */
	@Override
	public AuthSchool queryAuthSchoolInfoByAccount(String account)
			throws SQLException {
		AuthSchool a = authSchoolRepository
				.queryAuthSchoolInfoByAccount(account);
		return a;
	}

	@Override
	public Page<AuthSchool> queryAuthSchoolInfoByPage(Integer pageNumber,
			Integer pageSize, Map<String, String> map) throws SQLException {
		// TODO Auto-generated method stub
		Page<AuthSchool> page = authSchoolRepository.queryAuthSchoolInfoByPage(
				pageNumber, pageSize, map);
		return page;
	}

	//查找机构代码
	@Override
	public AuthSchool queryAuthSchoolInfoByAccount(String account, String major)
			throws SQLException {
		// TODO Auto-generated method stub
		AuthSchool a = authSchoolRepository.queryAuthSchoolInfoByAccount(
				account, major);
		return a;
	}

	//查找ID
	@Override
	public AuthSchool queryAuthSchoolInfoBypid(String pid) throws SQLException {
		AuthSchool as = authSchoolRepository.queryAuthSchoolInfoById(pid);
		return as;
	}
		

	// 按照专业名称查询
	@Override
	public Page<AuthSchool> queryAuthSchoolPageInforBymajor(Map<String,String>map)throws SQLException {
		Page<AuthSchool> a = authSchoolRepository.queryAuthSchoolPageInforBymajor(map);
		return a;
	}

	// 删除
	@Override
	public void deleteAuthSchoolInfo(String pid) throws SQLException {
		authSchoolRepository.deleteuthSchoolInfo(pid);
	}

	// 更新学校数据/修改机构代码信息/修改专业信息
	@Override
	public void updateAuthSchoolInfo(AuthSchool as) throws SQLException {
		authSchoolRepository.updateAuthSchoolInfo(as);
	}

	// 模糊查询学校名称
	@Override
	public AuthSchool queryAuthSchoolInforByschoolName(String schoolName)
			throws SQLException {
		AuthSchool a = authSchoolRepository
				.queryAuthSchoolInforByschoolName(schoolName);
		return a;
	}

	// 修改所有状态
	@Override
	public void updateAuthSchoolInfoAll(AuthSchool as) throws SQLException {
		authSchoolRepository.updateAuthSchoolInfo(as);
	}

	//分页查询
	/*@Override
	public Page<AuthSchool> queryAuthSchoolPage(Integer pageNumber,Integer pageSize ,Map<String,String>map) throws SQLException{
		Page<AuthSchool> page = authSchoolRepository.queryAuthSchoolPage(pageNumber, pageSize, map);
		return page;
	}*/

	//分页查询2
	@Override
	public Page<AuthSchool> queryAuthSchoolPage(Map<String, String> map)
			throws SQLException {
		Page<AuthSchool> page = authSchoolRepository.queryAuthSchoolPage(map);
		return page;
	}

	/* (non-Javadoc)
	 * @see com.orange.handler.AuthSchoolService#queryAuthSchoolInfoById(java.lang.String)
	 */
	@Override
	public AuthSchool queryAuthSchoolInfoById(String pid) throws SQLException {
		AuthSchool a=authSchoolRepository.queryAuthSchoolInfoById(pid);
		return a;
	}

	/* (non-Javadoc)
	 * @see com.orange.handler.AuthSchoolService#queryUnAuthSchoolList()
	 */
	@Override
	public List<AuthSchool> queryUnAuthSchoolList() throws SQLException {
		List<AuthSchool> ls=authSchoolRepository.queryUnAuthSchoolList();
		return ls;
	}

	@Override
	public AuthSchool queryAuthSchoolAllId() throws SQLException{
		// TODO Auto-generated method stub
		AuthSchool a = authSchoolRepository.queryAuthSchoolAllId();
		return a;
	}


	/* (non-Javadoc)
	 * @see com.orange.handler.AuthSchoolService#queryAuthSchoolAndObservation(java.lang.String, java.util.Map)
	 */
	@Override
	public Page<AuthSchool> queryAuthSchoolAndObservation(String expertId,
			Map<String, String> map) throws SQLException {
		Page<AuthSchool> ls=authSchoolRepository.queryAuthSchoolAndObservation(expertId, map);
		return ls;
	}

	/* (non-Javadoc)
	 * @see com.orange.handler.AuthSchoolService#queryAuthSchoolAndTask(java.lang.String, java.util.Map)
	 */
	@Override
	public Page<ExpertTaskBean> queryAuthSchoolAndTask(String expertId,
			Map<String, String> map) throws SQLException {
		Page<ExpertTaskBean> page=authSchoolRepository.queryAuthSchoolAndTask(expertId, map);
		return page;
	}

	/* (non-Javadoc)
	 * @see com.orange.handler.AuthSchoolService#queryAuthSchoolOneIndexAndTask(java.lang.String, java.util.Map)
	 */
	@Override
	public Page<ExpertTaskBean> queryAuthSchoolOneIndexAndTask(String expertId,
			Map<String, String> map) throws SQLException {
		Page<ExpertTaskBean> page=authSchoolRepository.queryAuthSchoolOneIndexAndTask(expertId, map);
		return page;
	}

	/* (non-Javadoc)
	 * @see com.orange.handler.AuthSchoolService#queryAuthSchoolListHaveSubmit()
	 */
	@Override
	public List<AuthSchool> queryAuthSchoolListHaveSubmit() throws SQLException {
		List<AuthSchool> list=authSchoolRepository.queryAuthSchoolListHaveSubmit();
		return list;
	}

	@Override
	public Page<SchoolItemBean> queryAuthSchoolItemById(String expertId,
			Map<String, String> map) throws SQLException {
		Page<SchoolItemBean> page = authSchoolRepository.queryAuthSchoolItemById(expertId, map);
		return page;
	}
	
	/**
	 * 材料评审--分页查询专家绑定的分项指标
	 */
	public List<SchoolItemBean> queryAuthItemByExportIdAndSchoolId(String expertId,String schoolId) throws SQLException{
		List<SchoolItemBean> list = authSchoolRepository.queryAuthItemByExportIdAndSchoolId(expertId, schoolId);
		return list;
		
	}

	@Override
	public Page<AuthSchool> queryAuthSchoolByGroupId(String groupId,
			Map<String, String> map) throws SQLException {
		Page<AuthSchool> page = authSchoolRepository.queryAuthSchoolByGroupId(groupId, map);
		return page;
	}

	@Override
	public Page<AuthSchool> queryAuthSchoolPageByExportId(String exportId,
			Map<String, String> map) throws SQLException {
		Page<AuthSchool> page = authSchoolRepository.queryAuthSchoolPageByExportId(exportId, map); 
		return page;
	}


}
